﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Hos.ScheduleMaster.Core.Common
{
    public class DingTalkHelper
    {
        public static void SendText(string title,string content)
        {
            string dingTalk_Webhook = ConfigurationCache.GetField<string>(ConfigurationCache.DingTalk_Webhook);
            string dingTalk_Secret = ConfigurationCache.GetField<string>(ConfigurationCache.DingTalk_Secret);
            if (string.IsNullOrWhiteSpace(dingTalk_Webhook) || string.IsNullOrWhiteSpace(dingTalk_Secret))
            {
                return;
            }
            NFinal.Common.DingTalk.DingRobot dingRobot = new NFinal.Common.DingTalk.DingRobot(dingTalk_Webhook, dingTalk_Secret);
            dingRobot.SendTextMessage(
                 $"{title}\r\n" + content);
        }
    }
}
